Back to course home
0% completed
Vote For New Content
Oracle Hard
Integer to English Words (hard)
Solution: Integer to English Words
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Merge K Sorted Lists (hard)
Solution: Merge K Sorted Lists
Max Points on a Line (hard)
Solution: Max Points on a Line
Sudoku Solver (hard)
Solution: Sudoku Solver
Longest Valid Parentheses (hard)
Solution: Longest Valid Parentheses
Remove Nth Node From End of List (Medium)
Solution: Remove Nth Node From End of List
Median of Two Sorted Arrays (hard)
Solution: Median of Two Sorted Arrays
Constrained Subsequence Sum (hard)
Solution: Constrained Subsequence Sum
Meeting Rooms II (medium)
Problem Statement
Given an array of meeting intervals where intervals[i] = [starti, endi], return the minimum number of meeting rooms needed so that no meetings overlap.
Examples
Example 1:
- Input: intervals =
[[10, 15], [20, 25], [30, 35]] - Expected Output:
1 - Justification: There are no overlapping intervals in the given list. So, only 1 meeting room is enough for all the meetings.
Example 2:
- Input: intervals =
[[10, 20], [15, 25], [24, 30], [5, 14], [22, 28], [1, 4], [27, 35]] - Expected Output:
3 - Justification:
Let's see how many meetings overlap at the same time:
- [1, 4] starts first.
- Then [5, 14] begins, no overlap yet.
- [10, 20] overlaps with [5, 14]
- [15, 25] overlaps with [10, 20]
- [22, 28] overlaps with [15, 25]
- [24, 30] overlaps with both [22, 28] and [15, 25]
- [27, 35] overlaps with [24, 30]
Example 3:
- Input: intervals =
[[10, 20], [20, 30]] - Expected Output:
1 - Justification: The end time of the first meeting is the same as the start time of the second meeting. So, one meeting can be scheduled right after the other in the same room.
Constraints:
- 1 <= intervals.length <= 104
- 0 <= starti < endi <= 106
Try it yourself
Try solving this question here:
Java
. . . .
Solution: Rotting Oranges
Solution: Meeting Rooms II
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself